package com.jackrain.nea.utility;

import com.jackrain.nea.exception.NDSException;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author lzm
 * @date 2017-12-22
 */
public class ExceptionUtil {
    public static String getMessage(Exception ex){
        String message = ex.getMessage();
        if(!(ex instanceof NDSException)){
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            message = sw.toString().replace("\n","<br/>").replace("\tat","");
        }
        return message;
    }
}
